package com.sc.nft.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.sc.nft.dao.UserCityServerCentreDao;
import com.sc.nft.dao.UserInfoDao;
import com.sc.nft.entity.ApplicationRequirement;
import com.sc.nft.entity.UserCityServerCentre;
import com.sc.nft.entity.UserInfo;
import com.sc.nft.entity.vo.ApplicationRequirementFactoryVO;
import com.sc.nft.enums.ApplicationRequirementEnum;
import com.sc.nft.service.ApplicationRequirementFactoryService;
import com.sc.nft.util.DecideUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 持仓有效用户
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class ValidApplicationRequirementFactoryServiceImpl implements ApplicationRequirementFactoryService {

    private final UserInfoDao userInfoDao;

    private final UserCityServerCentreDao userCityServerCentreDao;

    @Override
    public ApplicationRequirementFactoryVO applicationRequirement(UserInfo userInfo, ApplicationRequirement applicationRequirement,Integer type) {
//        Boolean urbanServiceCenter=Boolean.TRUE;
//        UserCityServerCentre userCityServerCentre = userCityServerCentreDao.selectByUserId(userInfo.getId());
//        if (BeanUtil.isEmpty(userCityServerCentre)) {
//            urbanServiceCenter=Boolean.FALSE;
//        }
//        // 根据结果集的id,获取有效的用户.
//        Integer byListUserIdCountValid = userInfoDao.getByListUserIdCountValid(userInfo.getId(),type.intValue()==2);
//
//        ApplicationRequirementFactoryVO applicationRequirementFactoryVO = new ApplicationRequirementFactoryVO();
//        applicationRequirementFactoryVO.setKey(StrUtil.format("{}{}{}", applicationRequirement.getType().getDescription(), applicationRequirement.getJudgingCriteria(), applicationRequirement.valueConvert()));
//        applicationRequirementFactoryVO.setAskForValue(applicationRequirement.getValue());
//        applicationRequirementFactoryVO.setPracticalValue(byListUserIdCountValid);
//        applicationRequirementFactoryVO.setSatisfy(DecideUtil.conditionalDecision(byListUserIdCountValid, applicationRequirement.getValue(), applicationRequirement.getJudgingCriteria()));
//        return applicationRequirementFactoryVO;
        return null;
    }

    @Override
    public Integer code() {
        return ApplicationRequirementEnum.TEAM_ACTIVE_USER.getCode();
    }

}
